<template>
  <div style="padding:10px;">
    <div class="list">
      <input @click="cehcks(item)" :checked="item.checked" type="checkbox" />
      <img alt="" :src="item.img" />
      <div class="rightSc">
        <div>
          <span> {{ item.name }} </span>
        </div>
        <div class="cartbTOM">
          <p style="color:red;">{{ item.price }}</p>
          <p>
            <button>-</button
            ><input v-model="item.num" class="inputss" type="text" />
            <button>+</button>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { computed } from "vue";
import { useStore } from "vuex";
export default {
  props: ["item"],
  setup() {
    let store = useStore();
    function cehcks(item) {
      store.commit("check", item);
    }
    return {
      cehcks,
    };
  },
};
</script>

<style lang="scss" scoped>
[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.list {
  width: 100%;
  height: 8rem;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cartbTOM {
  display: flex;
  justify-content: space-around;
}
button {
  width: 20px;
}
img {
  width: 100px;
  height: 80%;
}
.rightSc {
  width: 60%;
}
.inputss {
  width: 30px;
}
span {
  font-size: 12px;
}
</style>
